<?php
/**
 * 前台首页控制器
 * @author e5
 *
 */
class IndexController extends CommonController{
	public function index(){
		//获得全部分类
		$cateData = K("Category")->all();
		//获得顶级分类
		$topCate = array();
		foreach ($cateData as $v){
			if ($v['pid'] == 0){
				$topCate[] = $v;
			}
		}
		$this->assign("topCate",$topCate);
		$this->assign("cateData",$cateData);
		//获得最新商品
		$newGoods = K("Goods")->field("gid,gname,gshopprice,gpic")->order("guptime DESC")->limit(15)->all();
		$this->assign("newGoods",$newGoods);
		//获得热门商品
		$hotGoods = K("Goods")->field("gid,gname,gshopprice,gpic")->order("gclick DESC")->limit(15)->all();
		$this->assign("hotGoods",$hotGoods);
		$this->dis();
	}
}